﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RayTracer;
using Balloonerds.Algebra;

namespace Demo
{
    public class SceneFactory
    {
        public static Scene BasicScene()
        {
            var scene = new Scene();
            scene.HorizonColor = scene.ZenithColor = new Color(.02, 0, .1);

            return scene;
        }

        public static Scene Mollecules()
        {
            var scene = BasicScene();

            scene.Camera.Position = new Vector(50, 10, 0);
            scene.Camera.LookTowards = new Vector(0, 4, 0);
            scene.Camera.FocalLength = .060;

            scene.Lights.Add(new Light()
            {
                Position = new Vector(20, 50, 20),
                Color = Color.White
            });

            //scene.Lights.Add(new Spotlight()
            //{
            //    Position = new Vector(50, 50, 0),
            //    Direction = scene.Camera.LookTowards - new Vector(50, 20, 0),
            //    Angle = 20 * Math.PI / 180,
            //    Color = Color.White
            //});

            scene.Objects.Add(
                 Mol.LoadMol("mol\\caffeine.mol")
                 .RotateY(-Math.PI / 2)
                 .Translate(new Vector(0, 5, -6))
                );
            scene.Objects.Add(
                Mol.LoadMol("mol\\cocaine.mol")
                .RotateY(Math.PI / 2)
                .Translate(new Vector(0, 5, 6))
                );

            scene.Objects.Add(
                Thing.Floor(Color.White * .2)
                .Translate(new Vector(0, -2, 0))
                );

            return scene;
        }

        public static Scene PlatonicSolids()
        {
            var scene = BasicScene();

            scene.ZenithColor = Color.FromWMColor(System.Windows.Media.Colors.DeepSkyBlue);

            scene.Lights.Add(new Light()
            {
                Position = new Vector(20, 50, 20),
                Color = Color.White
            });

            scene.Objects.Add(Thing.Tetrahedron(Surface.Steel).Translate(new Vector(0, 0, -10)));
            scene.Objects.Add(Thing.Cube(Surface.Pyrite).Translate(new Vector(0, 0, -5)));
            scene.Objects.Add(Thing.Octahedron(Surface.Silver).Translate(new Vector(0, 0, 0)));
            scene.Objects.Add(Thing.Dodecahedron(Surface.Copper).Translate(new Vector(0, 0, 5)));
            scene.Objects.Add(Thing.Icosahedron(Surface.Gold).Translate(new Vector(0, 0, 10)));

            scene.Objects.Add(
                Thing.CheckeredFloor(10)
                .Translate(new Vector(0, -3, 0))
                );

            scene.Camera.Position = new Vector(50, 5, 5);
            scene.Camera.FocalLength = .065;

            return scene;
        }
    }
}
